/**   
* @Title: EventSourceProduct.java 
* @Package cn.com.ytst.data.integration.core.channel.event 
* @Description: 
* @author 123774135@qq.com 
* @date 2020年6月12日 下午2:04:15 
* @version V1.0   
*/
package cn.com.ytst.data.integration.core.channel.event;

import com.lmax.disruptor.EventTranslatorOneArg;
import com.lmax.disruptor.RingBuffer;

/** 
* @ClassName: EventSourceProduct 
* @Description: 事件发送
* @author 123774135@qq.com 
* @date 2020年6月12日 下午2:04:15 
*  
*/
public class EventSourceProduct {

	
	private RingBuffer<EventBuilder> ringBuffer;
	
	public EventSourceProduct(RingBuffer<EventBuilder> ringBuffer) {
		this.ringBuffer = ringBuffer;
	}
	
	private static final EventTranslatorOneArg<EventBuilder,String> TRANSLATOR = new EventTranslatorOneArg<EventBuilder,String>() {

        @Override
        public void translateTo(EventBuilder event, long sequence, String value) {
            event.setLine(value);
        }
    };
    
    public void put(String line) {
    	ringBuffer.publishEvent(TRANSLATOR, line);
    }
    
}
